import { get, post, put, del } from "../../../utils/request";
import { type AddParams, type ListData, type ListParams, type ListResult } from "./type";

export const getDischargeList = (data: ListParams) => {
  return get<ListParams, ListResult>("/api/discharge/list", data);
};

export const addDischarge = (data: AddParams) => {
  return post<AddParams, ListData>("/api/discharge/add", data);
};

//获取单条
export const getDischargeModel = (id: number) => {
  return get<number, ListData>(`/api/discharge/get/${id}`);
};

//修改
export const updateDischarge = (data: AddParams) => {
  return put<AddParams, ListData>("/api/discharge/update", data);
};

//单删
export const delDischarge = (id: number) => {
  return del<number, null>(`/api/discharge/delete/${id}`);
};

//批量删除
export const delMany = (ids: number[]) => {
  return post<number[], null>("/api/discharge/deleteAll", ids);
};
